package com.deep.test.bio;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;
import java.net.UnknownHostException;

public class BioClient {
public static void main(String[] args) throws UnknownHostException, IOException {
	 Socket socket = new Socket("127.0.0.1", 9100);  
     BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));  
     PrintWriter out = new PrintWriter(socket.getOutputStream(), true);  
     BufferedReader systemIn = new BufferedReader(new InputStreamReader(System.in));  
     boolean flag = true;  
     while (flag) {  
         String line = systemIn.readLine();  
         if ("exit".equals(line)) {  
             flag = false;  
             out.print("exit");  
             out.close();  
             in.close();  
             socket.close();  
             continue;  
         }  
         out.println(line);  //这里不能用 out.print(line);  
         String response = in.readLine();  
         System.out.println(response);  
     }  
}
}
